﻿using HelloWPF.FirstMVVM.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HelloWPF.FirstMVVM.ViewModels
{
    public class FirstMVVMViewModel
    {
        public FirstMVVMModel FirstMVVMModel { get; set; } = new FirstMVVMModel();

        public FirstMVVMViewModel()
        {
            Task.Factory.StartNew(() =>
            {
                Task.Delay(4000).Wait();
                //4秒后延迟执行
                Add();
            });
        }

        /// <summary>
        /// 一个值加另一个值 == 第三个值 
        /// 业务逻辑
        /// </summary>
        public void Add()
        {
            FirstMVVMModel.Value3 = FirstMVVMModel.Value1 + FirstMVVMModel.Value2;
        }
    }
}
